import 'package:my_app/app/data/model/user.dart';
import 'package:my_app/app/data/provider/api/dio_tool_api.dart';

/// dio_tool_repository.dart
///
/// Created by fuchuanwei on Tue Feb 21 2023.
///
/// Description: Dio工具 Repository
///
class DioToolRepository {
  final DioToolApi api;

  DioToolRepository(this.api);

  Future<String> getTest() async {
    final data = await api.getTest();
    return data.toString();
  }

  Future<String> postTest() async {
    final data = await api.postTest();

    return data.toString();
  }

  Future<String> deleteTest() async {
    final data = await api.deleteTest();

    return data.toString();
  }

  Future<String> putTest() async {
    final data = await api.putTest();
    return data.toString();
  }

  Future<User> getUser() async {
    User user = await api.getUser();
    print('user:${user.toJson()}');
    return user;
  }
}
